﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WebPALTT.UI
{
    public partial class ScriptOptionsForm : Form
    {
        List<string> mCompileParam = new List<string> { };
        List<string> mUsingPrama = new List<string> { };

        public List<string> CompileParameters { get { return mCompileParam; } }
        public List<string> UsingStatements { get { return mUsingPrama; } }

        public ScriptOptionsForm()
        {
            InitializeComponent();
            RefreshUI();
        }

        public void RefreshUI()
        {
            tb_CompileParam.Text = "";
            foreach (string s in mCompileParam)
                tb_CompileParam.Text += s + "\n";

            tb_UsingParam.Text = "";
            foreach (string s in mUsingPrama)
                tb_UsingParam.Text += s + "\n";
        }

        private void b_Save_Click(object sender, EventArgs e)
        {
            mUsingPrama.Clear();
            mUsingPrama.AddRange(tb_UsingParam.Text.Split(new char[] { '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries));
            mCompileParam.Clear();
            mCompileParam.AddRange(tb_CompileParam.Text.Split(new char[] { '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries));
            this.DialogResult = System.Windows.Forms.DialogResult.OK;
            this.Close();
        }

        private void b_Cancel_Click(object sender, EventArgs e)
        {
            this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
            this.Close();
        }
    }
}
